﻿package{
	
	
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.ui.Mouse;
	
	public class GUI_Cursor extends MovieClip{
		
		
		public static var cursor:GUI_Cursor;
		public static var cursorSTATE:int = 0;
		//0: Normal
		//1: SCombo
		//2: Block
		//3: Button
		
		public function GUI_Cursor(){
			
			addEventListener(Event.ADDED_TO_STAGE, Init);
		}
		
		private function Init(e:Event) {
			removeEventListener(Event.ADDED_TO_STAGE, Init);
			
			stage.addEventListener(MouseEvent.MOUSE_MOVE, onMove);
			stage.addEventListener(MouseEvent.MOUSE_DOWN, onMD);
			stage.addEventListener(MouseEvent.MOUSE_UP, onMU);
			
			Mouse.hide();
			
			
			cursor = this;
			
			mouseEnabled = false;
			mouseChildren = false;
			
			//커서가 스테이지를 벗어나면 사라지게 하기
			
		}
		
		
		private function onMove(e:MouseEvent){
			this.x = stage.mouseX;
			this.y = stage.mouseY;
			
			e.updateAfterEvent();
		}
		
		public function setCursor(_cursor:int) {
			if (Menu_InGame.isBonusTime) return;
			
			cursorSTATE = _cursor;
			gotoAndStop(cursorSTATE + 1);
		}
		
		
		private function onMD(e:MouseEvent){
			if (sub) sub.gotoAndStop(2);
			
			Mouse.hide();
		}
		
		private function onMU(e:MouseEvent){
			if(sub) sub.gotoAndStop(1);
			
		}
		
	}
	
	
	
	
}